import type {
  ProFormColumnsType,
} from '@ant-design/pro-components';
import { BetaSchemaForm } from '@ant-design/pro-components';
import { useTranslation } from 'react-i18next';

type QueryFilter = {
  initialData: any,
  columns: ProFormColumnsType[],
  onFinish: any,
}

const Form = (props: QueryFilter) => {
  const { t } = useTranslation();
  return (
    <>
      <BetaSchemaForm
        style={{padding: '0'}}
        size="small"
        layout="vertical"
        layoutType='QueryFilter'
        rowProps={{gutter: [16, 16]}}
        colProps={{span: 8,}}
        onFinish={props.onFinish}
        initialValues={{ search: props.initialData.search,code:props.initialData.code,companyName:props.initialData.companyName,searchValue:props.initialData.searchValue,inci:props.initialData.inci,name:props.initialData.name,decription:props.initialData.decription,annex:props.initialData.annex, }}
        onReset={() => props.onFinish(null)}
        columns={props.columns as any}
        searchText={t('search')}
        resetText={t('cancel')}
      />
    </>
  );
};

export default Form